﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace System
{
    public interface IBaseDAL<T> : IBaseDal, IEBaseDAL<T> where T : BaseModel, new()
    {

        int Add(T model, string fields);
        int Add(List<T> list, string fields);
        int Add(T model, string fields, string tableName);
        int Add(List<T> list, string fields, string tableName);

        int Remove(T model);
        int Remove(List<T> list);
        int Remove(string id);
        int Remove(T model, string tableName);
        int Remove(List<T> list, string tableName);
        int Remove(string id, string tableName);

        int Modify(T model, string fields);
        int Modify(List<T> list, string fields);
        int Modify(T model, string fields, string tableName);
        int Modify(List<T> list, string fields, string tableName);

        int AddOrModify(T model, string fields);
        int AddOrModify(List<T> list, string fields);
        int AddOrModify(T model, string fields, string tableName);
        int AddOrModify(List<T> list, string fields, string tableName);
        T GetModel(string fields, string filter, string sorts, string tableName, List<DBParameter> parameters);

        T GetModel(string id, string fields, string tableName);
        T GetModel(List<DBParameter> parameters, string fields, string tableName);
        T GetModel(string fields, string filter, string sorts, List<DBParameter> parameters);
        T GetModel(string id, string fields);
        T GetModel(string id);
        T GetModel(List<DBParameter> parameters, string fields);
        T GetModel(string sql, List<DBParameter> parameters);

        List<T> GetList();
        List<T> GetList(string sql, List<DBParameter> parameters);
        List<T> GetList(string fields, string filter, string sorts, List<DBParameter> parameters);
        List<T> GetList(int? pageIndex, int? pageSize, ref int? recordCount, string fields, string filter, string sorts, List<DBParameter> parameters);
        List<T> GetList(string tableName);
        List<T> GetList(string fields, string filter, string sorts, string tableName, List<DBParameter> parameters);
        List<T> GetList(int? pageIndex, int? pageSize, ref int? recordCount, string fields, string filter, string sorts, string tableName, List<DBParameter> parameters);
        
        T GetModel(IDataReader dr);
        T GetModel(DataRow dr);
        T GetModel(DataRowView dv);

        List<T> GetList(IDataReader dr);
        List<T> GetList(DataTable dt);
        List<T> GetList(DataView dv);

        T GetModel(SqlInfo sqlInfo, List<DBParameter> parameters);
        List<T> GetList(SqlInfo sqlInfo, List<DBParameter> parameters);
        List<T> GetList(PageInfo pageInfo, List<DBParameter> parameters);

        List<T> GetTop(int count);
        List<T> GetTop(int count, string sorts);
        List<T> GetTop(int count, string fields, string filter, string sorts, List<DBParameter> parameters);

        List<T> GetTop(string tableName, int count);
        List<T> GetTop(string tableName, int count, string sorts);
        List<T> GetTop(string tableName, int count, string fields, string filter, string sorts, List<DBParameter> parameters);

        int InsertOrUpdateBySQL(T model);
        int InsertOrUpdateBySQL(List<T> list);
        int InsertOrUpdateBySQL(T model, string fields);
        int InsertOrUpdateBySQL(List<T> list, string fields);
        int InsertOrUpdateBySQL(T model, string fields, string tableName);
        int InsertOrUpdateBySQL(List<T> list, string fields, string tableName);
    }
}
